:root {
  /* Enhanced Light Theme (NEW DEFAULT) */
  --std-light-bg: #f5f7fa; /* Softer background */
  --std-light-header-bg: #ffffff; 
  --std-light-sider-bg: #ffffff; 
  --std-light-footer-bg: #f5f7fa; 
  --std-light-content-bg: #f8fafc; /* Cleaner content background */
  --std-light-card-bg: #ffffff; 
  --std-light-card-header-bg: #f9fafb; /* Subtle header gradient */
  --std-light-border-color: #e2e8f0; /* Softer borders */
  --std-light-primary-color: #2563eb; /* More vibrant blue */
  --std-light-secondary-color: #10b981; /* Updated green */
  --std-light-success-color: #22c55e; 
  --std-light-warning-color: #f59e0b; 
  --std-light-error-color: #ef4444; 
  --std-light-text-primary: #1e293b; /* Darker for better contrast */
  --std-light-text-secondary: #64748b; 
  --std-light-text-tertiary: #94a3b8; 
  --std-light-text-title: #1e293b; 
  --std-light-text-input: #1e293b; 
  --std-light-input-bg: #ffffff; 
  --std-light-input-border-color: #cbd5e1; 
  --std-light-menu-text: #334155; 
  --std-light-menu-selected-text: #ffffff; 
  --std-light-menu-hover-text: #2563eb; 
  --std-light-menu-selected-bg: #2563eb; 
  --std-light-menu-hover-bg: #dbeafe; 
  --std-light-modal-header-bg: #ffffff;
  --std-light-drawer-header-bg: #ffffff;
  --std-light-table-header-bg: #f8fafc; 
  --std-light-watermark-color: rgba(30, 41, 59, 0.03); 
  --std-light-box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08), 0 2px 4px rgba(0, 0, 0, 0.05);
  --std-light-card-shadow: 0 2px 8px rgba(0, 0, 0, 0.08), 0 1px 4px rgba(0, 0, 0, 0.05);
  --std-light-primary-color-rgb: 37, 99, 235; /* Primary color in RGB for shadows */


  /* Enhanced Dark Theme (科技感深蓝) */
  --dark-blue-bg: #0f172a;
  --dark-blue-header-bg: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  --dark-blue-sider-bg: #1e293b;
  --dark-blue-footer-bg: #1e293b;
  --dark-blue-content-bg: #0d1321; 
  --dark-blue-card-bg: #1e293b; 
  --dark-blue-card-header-bg: #334155;
  --dark-blue-border-color: #334155;
  --dark-blue-primary-color: #60a5fa; /* Blue accent */
  --dark-blue-secondary-color: #c084fc; /* Purple accent */
  --dark-blue-success-color: #34d399; /* Green for success */
  --dark-blue-warning-color: #fbbf24; /* Yellow for warning */
  --dark-blue-error-color: #f87171; /* Red for error */
  --dark-blue-text-primary: #e2e8f0;
  --dark-blue-text-secondary: #94a3b8;
  --dark-blue-text-tertiary: #64748b;
  --dark-blue-text-title: #60a5fa; /* Title color matches primary for tech feel */
  --dark-blue-text-input: #e2e8f0;
  --dark-blue-input-bg: #141f30; /* Opaque dark background for inputs */
  --dark-blue-input-border-color: #475569;
  --dark-blue-menu-text: #cbd5e1;
  --dark-blue-menu-selected-text: #0f172a; /* Dark text on bright selected */
  --dark-blue-menu-hover-text: #60a5fa;
  --dark-blue-menu-selected-bg: #60a5fa;
  --dark-blue-menu-hover-bg: rgba(96, 165, 250, 0.15);
  --dark-blue-modal-header-bg: #1e293b;
  --dark-blue-drawer-header-bg: #1e293b;
  --dark-blue-table-header-bg: #1e293b;
  --dark-blue-watermark-color: rgba(255, 255, 255, 0.05);
  --dark-blue-box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3), 0 4px 6px rgba(0, 0, 0, 0.2);
  --dark-blue-card-shadow: 0 4px 12px rgba(0, 0, 0, 0.3), 0 2px 4px rgba(0, 0, 0, 0.2);
  --dark-blue-primary-color-rgb: 96, 165, 250; /* Primary color in RGB for shadows */


  /* Ice Theme - Enhanced */
  --ice-bg: #f0f9ff;
  --ice-header-bg: #e0f2fe;
  --ice-sider-bg: #ffffff;
  --ice-footer-bg: #e0f2fe;
  --ice-content-bg: #f0f9ff;
  --ice-card-bg: #ffffff;
  --ice-card-header-bg: #dbeafe;
  --ice-border-color: #bae6fd;
  --ice-primary-color: #3b82f6;
  --ice-secondary-color: #60a5fa;
  --ice-success-color: #22c55e;
  --ice-warning-color: #fbbf24;
  --ice-error-color: #ef4444;
  --ice-text-primary: #1e293b;
  --ice-text-secondary: #475569;
  --ice-text-tertiary: #94a3b8;
  --ice-text-title: #1d4ed8;
  --ice-text-input: #1e293b;
  --ice-input-bg: #ffffff;
  --ice-input-border-color: #bae6fd;
  --ice-menu-text: #334155;
  --ice-menu-selected-text: #ffffff;
  --ice-menu-hover-text: #3b82f6;
  --ice-menu-selected-bg: #3b82f6;
  --ice-menu-hover-bg: rgba(59, 130, 246, 0.1);
  --ice-modal-header-bg: #dbeafe;
  --ice-drawer-header-bg: #dbeafe;
  --ice-table-header-bg: #dbeafe;
  --ice-watermark-color: rgba(30, 64, 175, 0.05);
  --ice-box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15), 0 2px 4px rgba(59, 130, 246, 0.1);
  --ice-primary-color-rgb: 59, 130, 246;

  /* Fire Theme - Enhanced */
  --fire-bg: #1a0000;
  --fire-header-bg: linear-gradient(135deg, #450a0a 0%, #1a0000 100%);
  --fire-sider-bg: #450a0a;
  --fire-footer-bg: #450a0a;
  --fire-content-bg: #290000;
  --fire-card-bg: #3f1010;
  --fire-card-header-bg: #5a1515;
  --fire-border-color: #7f1d1d;
  --fire-primary-color: #f97316; /* Orange */
  --fire-secondary-color: #fdba74; /* Lighter Orange */
  --fire-success-color: #34d399;
  --fire-warning-color: #fbbf24;
  --fire-error-color: #ef4444;
  --fire-text-primary: #fef3c7;
  --fire-text-secondary: #fde68a;
  --fire-text-tertiary: #fbbf24;
  --fire-text-title: #f97316;
  --fire-text-input: #fef3c7;
  --fire-input-bg: #2a0505; /* Opaque dark red */
  --fire-input-border-color: #7f1d1d;
  --fire-menu-text: #fde68a;
  --fire-menu-selected-text: #1a0000; /* Dark text on bright selected */
  --fire-menu-hover-text: #f97316;
  --fire-menu-selected-bg: #f97316;
  --fire-menu-hover-bg: rgba(249, 115, 22, 0.2);
  --fire-modal-header-bg: #5a1515;
  --fire-drawer-header-bg: #5a1515;
  --fire-table-header-bg: #5a1515;
  --fire-watermark-color: rgba(251, 191, 36, 0.08);
  --fire-box-shadow: 0 10px 20px rgba(0, 0, 0, 0.5), 0 4px 6px rgba(0, 0, 0, 0.3);
  --fire-primary-color-rgb: 249, 115, 22;
}

/* Theme Application */
.theme-standard-light {
  --theme-background: var(--std-light-bg);
  --theme-header-bg: var(--std-light-header-bg);
  --theme-sider-bg: var(--std-light-sider-bg);
  --theme-footer-bg: var(--std-light-footer-bg);
  --theme-content-bg: var(--std-light-content-bg);
  --theme-card-bg: var(--std-light-card-bg);
  --theme-card-header-bg: var(--std-light-card-header-bg);
  --theme-border-color: var(--std-light-border-color);
  --theme-primary-color: var(--std-light-primary-color);
  --theme-secondary-color: var(--std-light-secondary-color);
  --theme-success-color: var(--std-light-success-color);
  --theme-warning-color: var(--std-light-warning-color);
  --theme-error-color: var(--std-light-error-color);
  --theme-text-primary: var(--std-light-text-primary);
  --theme-text-secondary: var(--std-light-text-secondary);
  --theme-text-tertiary: var(--std-light-text-tertiary);
  --theme-text-title: var(--std-light-text-title);
  --theme-text-input: var(--std-light-text-input);
  --theme-input-bg: var(--std-light-input-bg);
  --theme-input-border-color: var(--std-light-input-border-color);
  --theme-menu-text: var(--std-light-menu-text);
  --theme-menu-selected-text: var(--std-light-menu-selected-text);
  --theme-menu-hover-text: var(--std-light-menu-hover-text);
  --theme-menu-selected-bg: var(--std-light-menu-selected-bg);
  --theme-menu-hover-bg: var(--std-light-menu-hover-bg);
  --theme-modal-header-bg: var(--std-light-modal-header-bg);
  --theme-drawer-header-bg: var(--std-light-drawer-header-bg);
  --theme-table-header-bg: var(--std-light-table-header-bg);
  --theme-watermark-color: var(--std-light-watermark-color);
  --theme-box-shadow: var(--std-light-box-shadow);
  --theme-card-shadow: var(--std-light-card-shadow);
  --theme-button-primary-text: #ffffff;
  --theme-primary-color-rgb: var(--std-light-primary-color-rgb);
}

.theme-default { /* 科技深蓝 */
  --theme-background: var(--dark-blue-bg);
  --theme-header-bg: var(--dark-blue-header-bg);
  --theme-sider-bg: var(--dark-blue-sider-bg);
  --theme-footer-bg: var(--dark-blue-footer-bg);
  --theme-content-bg: var(--dark-blue-content-bg);
  --theme-card-bg: var(--dark-blue-card-bg);
  --theme-card-header-bg: var(--dark-blue-card-header-bg);
  --theme-border-color: var(--dark-blue-border-color);
  --theme-primary-color: var(--dark-blue-primary-color);
  --theme-secondary-color: var(--dark-blue-secondary-color);
  --theme-success-color: var(--dark-blue-success-color);
  --theme-warning-color: var(--dark-blue-warning-color);
  --theme-error-color: var(--dark-blue-error-color);
  --theme-text-primary: var(--dark-blue-text-primary);
  --theme-text-secondary: var(--dark-blue-text-secondary);
  --theme-text-tertiary: var(--dark-blue-text-tertiary);
  --theme-text-title: var(--dark-blue-text-title);
  --theme-text-input: var(--dark-blue-text-input);
  --theme-input-bg: var(--dark-blue-input-bg);
  --theme-input-border-color: var(--dark-blue-input-border-color);
  --theme-menu-text: var(--dark-blue-menu-text);
  --theme-menu-selected-text: var(--dark-blue-menu-selected-text);
  --theme-menu-hover-text: var(--dark-blue-menu-hover-text);
  --theme-menu-selected-bg: var(--dark-blue-menu-selected-bg);
  --theme-menu-hover-bg: var(--dark-blue-menu-hover-bg);
  --theme-modal-header-bg: var(--dark-blue-modal-header-bg);
  --theme-drawer-header-bg: var(--dark-blue-drawer-header-bg);
  --theme-table-header-bg: var(--dark-blue-table-header-bg);
  --theme-watermark-color: var(--dark-blue-watermark-color);
  --theme-box-shadow: var(--dark-blue-box-shadow);
  --theme-card-shadow: var(--dark-blue-card-shadow);
  --theme-button-primary-text: var(--dark-blue-menu-selected-text);
  --theme-primary-color-rgb: var(--dark-blue-primary-color-rgb);
}

.theme-ice {
  --theme-background: var(--ice-bg);
  --theme-header-bg: var(--ice-header-bg);
  --theme-sider-bg: var(--ice-sider-bg);
  --theme-footer-bg: var(--ice-footer-bg);
  --theme-content-bg: var(--ice-content-bg);
  --theme-card-bg: var(--ice-card-bg);
  --theme-card-header-bg: var(--ice-card-header-bg);
  --theme-border-color: var(--ice-border-color);
  --theme-primary-color: var(--ice-primary-color);
  --theme-secondary-color: var(--ice-secondary-color);
  --theme-success-color: var(--ice-success-color);
  --theme-warning-color: var(--ice-warning-color);
  --theme-error-color: var(--ice-error-color);
  --theme-text-primary: var(--ice-text-primary);
  --theme-text-secondary: var(--ice-text-secondary);
  --theme-text-tertiary: var(--ice-text-tertiary);
  --theme-text-title: var(--ice-text-title);
  --theme-text-input: var(--ice-text-input);
  --theme-input-bg: var(--ice-input-bg);
  --theme-input-border-color: var(--ice-input-border-color);
  --theme-menu-text: var(--ice-menu-text);
  --theme-menu-selected-text: var(--ice-menu-selected-text);
  --theme-menu-hover-text: var(--ice-menu-hover-text);
  --theme-menu-selected-bg: var(--ice-menu-selected-bg);
  --theme-menu-hover-bg: var(--ice-menu-hover-bg);
  --theme-modal-header-bg: var(--ice-modal-header-bg);
  --theme-drawer-header-bg: var(--ice-drawer-header-bg);
  --theme-table-header-bg: var(--ice-table-header-bg);
  --theme-watermark-color: var(--ice-watermark-color);
  --theme-box-shadow: var(--ice-box-shadow);
  --theme-button-primary-text: #ffffff;
  --theme-primary-color-rgb: var(--ice-primary-color-rgb);
}

.theme-fire {
  --theme-background: var(--fire-bg);
  --theme-header-bg: var(--fire-header-bg);
  --theme-sider-bg: var(--fire-sider-bg);
  --theme-footer-bg: var(--fire-footer-bg);
  --theme-content-bg: var(--fire-content-bg);
  --theme-card-bg: var(--fire-card-bg);
  --theme-card-header-bg: var(--fire-card-header-bg);
  --theme-border-color: var(--fire-border-color);
  --theme-primary-color: var(--fire-primary-color);
  --theme-secondary-color: var(--fire-secondary-color);
  --theme-success-color: var(--fire-success-color);
  --fire-warning-color: #fbbf24; /* Yellow for warning */
  --fire-error-color: #ef4444; /* Red for error */
  --fire-text-primary: #fef3c7;
  --fire-text-secondary: #fde68a;
  --fire-text-tertiary: #fbbf24;
  --fire-text-title: #f97316;
  --fire-text-input: #fef3c7;
  --fire-input-bg: #2a0505; /* Opaque dark red */
  --fire-input-border-color: #7f1d1d;
  --fire-menu-text: #fde68a;
  --fire-menu-selected-text: #1a0000; /* Dark text on bright selected */
  --fire-menu-hover-text: #f97316;
  --fire-menu-selected-bg: #f97316;
  --fire-menu-hover-bg: rgba(249, 115, 22, 0.2);
  --fire-modal-header-bg: #5a1515;
  --fire-drawer-header-bg: #5a1515;
  --fire-table-header-bg: #5a1515;
  --fire-watermark-color: rgba(251, 191, 36, 0.08);
  --fire-box-shadow: 0 10px 20px rgba(0, 0, 0, 0.5), 0 4px 6px rgba(0, 0, 0, 0.3);
  --fire-primary-color-rgb: 249, 115, 22;
}

/* ======================== GLOBAL STYLES ======================== */
* {
  box-sizing: border-box;
  /* 调整动画速度，让主题切换更平滑 */
  transition: background-color 0.4s ease, color 0.4s ease, border-color 0.4s ease, box-shadow 0.4s ease;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
  background-color: var(--theme-background);
  color: var(--theme-text-primary);
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* 移除水印相关样式 */
/* .watermark {
  display: none !important;
} */

/* ======================== LAYOUT COMPONENTS ======================== */
.app-layout {
  background-color: var(--theme-background) !important;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

/* Header */
.app-header {
  background: var(--theme-header-bg);
  color: var(--theme-text-primary); 
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  box-shadow: var(--theme-box-shadow);
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--theme-border-color);
  height: 64px;
  transition: all 0.3s ease;
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  font-size: 28px;
  color: var(--theme-primary-color);
  transition: transform 0.3s ease;
}

.logo-text {
  color: var(--theme-text-title); 
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.5px;
}

.header-actions {
  display: flex;
  gap: 16px;
  align-items: center;
}

/* 移除不再需要的主题切换按钮样式，因为它现在是Ant Design组件的一部分 */
/* .theme-switch-container {
  display: flex;
  gap: 8px;
  background: var(--theme-input-bg);
  border-radius: 24px;
  padding: 4px;
  border: 1px solid var(--theme-border-color);
}

.theme-switch-btn {
  border: none;
  background: transparent;
  padding: 6px 12px;
  border-radius: 24px;
  cursor: pointer;
  color: var(--theme-text-secondary);
  font-size: 12px;
  transition: all 0.2s ease;
}

.theme-switch-btn.active {
  background: var(--theme-primary-color);
  color: var(--theme-button-primary-text);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
} */

.header-user {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 24px;
  background: var(--theme-input-bg);
  cursor: pointer;
  transition: all 0.2s ease;
}

.header-user:hover {
  background: var(--theme-menu-hover-bg);
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--theme-primary-color);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
}

.user-info {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-weight: 500;
  font-size: 14px;
  color: var(--theme-text-primary);
}

.user-role {
  font-size: 12px;
  color: var(--theme-text-tertiary);
}

/* Sider */
.app-sider {
  background: var(--theme-sider-bg) !important;
  box-shadow: var(--theme-box-shadow);
  border-right: 1px solid var(--theme-border-color);
  transition: all 0.3s ease !important;
  color: var(--theme-menu-text);
  height: calc(100vh - 64px); 
  position: sticky;
  top: 64px; 
  overflow-y: auto; /* 允许侧边栏内容滚动 */
  z-index: 90;
}

.sider-collapse-button {
  width: 100%;
  text-align: center;
  padding: 12px 0;
  color: var(--theme-text-secondary);
  transition: all 0.3s ease;
  border-bottom: 1px solid var(--theme-border-color);
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  position: absolute; /* 让按钮浮动在侧边栏右侧 */
  top: 12px; 
  right: -40px; /* 按钮向右偏移 */
  width: 40px; /* 按钮宽度 */
  height: 40px; /* 按钮高度 */
  border-radius: 50%; /* 圆形按钮 */
  background: var(--theme-sider-bg);
  box-shadow: var(--theme-box-shadow);
  z-index: 101; /* 确保在最上层 */
  border: 1px solid var(--theme-border-color);
}

.sider-collapse-button:hover {
  color: var(--theme-primary-color);
  background-color: var(--theme-menu-hover-bg);
  transform: scale(1.05);
}

.app-menu.ant-menu {
  border-right: none !important;
  background: transparent !important; 
  padding: 16px 8px;
}

.app-menu .ant-menu-item,
.app-menu .ant-menu-submenu-title {
  margin-bottom: 4px !important;
  border-radius: 8px !important;
  transition: all 0.2s ease !important;
  color: var(--theme-menu-text) !important;
  height: 48px;
  line-height: 48px;
  display: flex;
  align-items: center;
  font-weight: 500;
}

.app-menu .ant-menu-item .anticon,
.app-menu .ant-menu-submenu-title .anticon {
  font-size: 18px;
  margin-right: 12px;
  color: var(--theme-menu-text) !important;
  transition: all 0.2s ease;
}

.app-menu .ant-menu-item-selected {
  background-color: var(--theme-menu-selected-bg) !important;
  color: var(--theme-menu-selected-text) !important;
  font-weight: 600;
}

.app-menu .ant-menu-item-selected .anticon {
  color: var(--theme-menu-selected-text) !important;
}

.app-menu .ant-menu-item:not(.ant-menu-item-selected):hover,
.app-menu .ant-menu-submenu-title:hover {
  background-color: var(--theme-menu-hover-bg) !important;
  color: var(--theme-menu-hover-text) !important;
}

.app-menu .ant-menu-item:not(.ant-menu-item-selected):hover .anticon,
.app-menu .ant-menu-submenu-title:hover .anticon {
  color: var(--theme-menu-hover-text) !important;
}

.menu-badge {
  margin-left: auto;
}

/* Content Area */
.app-content {
  padding: 24px;
  background-color: var(--theme-content-bg);
  min-height: calc(100vh - 64px - 70px); 
  overflow-y: auto;
  transition: all 0.3s ease;
  position: relative;
}

.content-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 24px;
  margin-bottom: 24px;
}

.grid-full {
  grid-column: 1 / -1;
}

/* Footer */
.app-footer {
  text-align: center;
  color: var(--theme-text-secondary);
  background-color: var(--theme-footer-bg);
  border-top: 1px solid var(--theme-border-color);
  padding: 16px 24px;
  font-size: 13px;
  transition: all 0.3s ease;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.footer-links {
  display: flex;
  gap: 16px;
}

.footer-link {
  color: var(--theme-text-secondary);
  transition: color 0.2s ease;
}

.footer-link:hover {
  color: var(--theme-primary-color);
}

/* ======================== UI COMPONENTS ======================== */
/* Cards */
.control-card, .result-card, .details-card, 
.table-card, .chart-card, .ai-feature-card {
  background-color: var(--theme-card-bg) !important;
  border: 1px solid var(--theme-border-color) !important;
  box-shadow: var(--theme-card-shadow) !important;
  border-radius: 12px !important;
  margin-bottom: 24px;
  transition: all 0.3s ease;
  overflow: hidden;
}

.control-card .ant-card-head, 
.result-card .ant-card-head,
.details-card .ant-card-head, 
.table-card .ant-card-head,
.chart-card .ant-card-head, 
.ai-feature-card .ant-card-head {
  background-color: var(--theme-card-header-bg) !important;
  border-bottom: 1px solid var(--theme-border-color) !important;
  color: var(--theme-text-title);
  font-weight: 600;
  padding: 16px 20px;
  font-size: 16px;
}

.control-card .ant-card-body, 
.result-card .ant-card-body,
.details-card .ant-card-body, 
.table-card .ant-card-body,
.chart-card .ant-card-body, 
.ai-feature-card .ant-card-body {
  padding: 20px;
}

.card-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
  border-top: 1px solid var(--theme-border-color);
  padding-top: 16px;
}

/* Statistics */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-item {
  background: var(--theme-card-bg);
  border: 1px solid var(--theme-border-color);
  border-radius: 12px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.stat-item:hover {
  transform: translateY(-5px);
  box-shadow: var(--theme-card-shadow);
}

.stat-item .ant-statistic-title {
  color: var(--theme-text-secondary);
  font-size: 14px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.stat-item .ant-statistic-content {
  color: var(--theme-text-primary);
  font-size: 28px;
  font-weight: 700;
}

.stat-item.success .ant-statistic-content { 
  color: var(--theme-success-color); 
}

.stat-item.warning .ant-statistic-content { 
  color: var(--theme-warning-color); 
}

.stat-item .ant-statistic-content-prefix .anticon {
  font-size: 22px;
  margin-right: 8px;
  vertical-align: middle;
}

/* Image Uploader */
.image-upload-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.image-dragger.ant-upload-wrapper {
  background-color: var(--theme-input-bg);
  border: 2px dashed var(--theme-border-color);
  border-radius: 12px;
  padding: 24px;
  transition: all 0.3s ease;
  cursor: pointer;
}

.image-dragger.ant-upload-wrapper:hover {
  border-color: var(--theme-primary-color);
  background-color: var(--theme-menu-hover-bg);
}

.image-dragger .ant-upload-drag-icon .anticon {
  color: var(--theme-primary-color);
  font-size: 48px;
  margin-bottom: 16px;
}

.image-dragger .ant-upload-text {
  color: var(--theme-text-primary);
  font-size: 18px;
  font-weight: 500;
  margin-bottom: 8px;
}

.image-dragger .ant-upload-hint {
  color: var(--theme-text-secondary);
  font-size: 14px;
}

.image-preview-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.image-preview-item {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--theme-border-color);
  box-shadow: var(--theme-card-shadow);
}

.image-preview {
  width: 100%;
  height: 120px;
  object-fit: cover;
  display: block;
}

.image-preview-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.7);
  padding: 8px;
  color: white;
  font-size: 12px;
  transition: all 0.3s ease;
  transform: translateY(100%);
}

.image-preview-item:hover .image-preview-overlay {
  transform: translateY(0);
}

/* Results Display */
.result-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

@media (max-width: 992px) {
  .result-container {
    grid-template-columns: 1fr;
  }
}

.result-visualization {
  background: var(--theme-card-bg);
  border-radius: 12px;
  border: 1px solid var(--theme-border-color);
  padding: 20px;
  min-height: 400px;
  display: flex;
  flex-direction: column;
}

.result-details {
  background: var(--theme-card-bg);
  border-radius: 12px;
  border: 1px solid var(--theme-border-color);
  padding: 20px;
}

.result-placeholder {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 300px;
  background-color: var(--theme-card-bg);
  border: 2px dashed var(--theme-border-color);
  border-radius: 12px;
  color: var(--theme-text-secondary);
  padding: 40px;
  text-align: center;
}

.result-placeholder-icon {
  font-size: 64px;
  color: var(--theme-text-tertiary);
  margin-bottom: 16px;
}

/* Alert System */
.alert-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.safety-alert-main.ant-alert {
  border-radius: 12px;
  border-left: 4px solid;
  padding: 16px 20px;
}

.safety-alert-main.ant-alert-warning {
  border-left-color: var(--theme-warning-color);
}

.safety-alert-main.ant-alert-error {
  border-left-color: var(--theme-error-color);
}

.safety-alert-main.ant-alert-success {
  border-left-color: var(--theme-success-color);
}

.safety-alert-main .ant-alert-message {
  font-weight: 600;
  font-size: 16px;
}

.safety-alert-inner.ant-alert { 
  padding: 12px 16px;
  border-radius: 8px;
  margin-top: 8px;
}

/* Timeline */
.history-timeline .ant-timeline-item {
  padding-bottom: 32px;
}

.history-timeline .ant-timeline-item-tail {
  border-left: 2px solid var(--theme-border-color);
}

.history-timeline .ant-timeline-item-head {
  background-color: var(--theme-card-bg);
  border: 2px solid var(--theme-primary-color);
  width: 16px;
  height: 16px;
}

.timeline-card {
  margin-left: 32px;
  border-radius: 12px;
  box-shadow: var(--theme-card-shadow);
}

.timeline-info .ant-descriptions-item-label {
  color: var(--theme-text-secondary);
  font-weight: 500;
}

.timeline-info .ant-descriptions-item-content {
  color: var(--theme-text-primary);
  font-weight: 500;
}

/* Tables */
.ant-table-wrapper {
  border: 1px solid var(--theme-border-color);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--theme-card-shadow);
}

.ant-table {
  background-color: var(--theme-card-bg) !important;
  color: var(--theme-text-primary);
  border-radius: 12px;
}

.ant-table-thead > tr > th {
  background-color: var(--theme-table-header-bg) !important;
  color: var(--theme-text-title) !important;
  border-bottom: 1px solid var(--theme-border-color) !important;
  font-weight: 600;
  padding: 16px;
}

.ant-table-tbody > tr > td {
  border-bottom: 1px solid var(--theme-border-color) !important;
  color: var(--theme-text-secondary);
  padding: 12px 16px;
  transition: all 0.2s ease;
}

.ant-table-tbody > tr.ant-table-row:hover > td {
  background-color: var(--theme-menu-hover-bg) !important; 
  color: var(--theme-text-primary);
}

.ant-table-tbody > tr.ant-table-placeholder:hover > td {
  background-color: var(--theme-card-bg) !important;
}

.ant-table-pagination.ant-pagination {
  margin: 16px;
  display: flex;
  justify-content: flex-end;
}

/* Tabs */
.result-tabs .ant-tabs-nav, .cyber-tabs .ant-tabs-nav {
  margin-bottom: 0 !important; 
}

.result-tabs .ant-tabs-tab, .cyber-tabs .ant-tabs-tab {
  background-color: var(--theme-card-header-bg) !important; 
  border: 1px solid var(--theme-border-color) !important;
  color: var(--theme-text-secondary) !important;
  border-bottom: none !important;
  margin-right: 0;
  padding: 12px 24px !important;
  border-radius: 0;
  font-weight: 500;
  transition: all 0.2s ease;
}

.result-tabs .ant-tabs-tab:first-child, 
.cyber-tabs .ant-tabs-tab:first-child {
  border-radius: 12px 0 0 0 !important;
}

.result-tabs .ant-tabs-tab:last-child, 
.cyber-tabs .ant-tabs-tab:last-child {
  border-radius: 0 12px 0 0 !important;
}

.result-tabs .ant-tabs-tab-active, 
.cyber-tabs .ant-tabs-tab-active {
  background-color: var(--theme-card-bg) !important; 
  color: var(--theme-primary-color) !important;
  font-weight: 600;
  border-color: var(--theme-border-color) !important;
  border-bottom-color: var(--theme-card-bg) !important; 
  position: relative;
  top: 1px; 
}

.result-tabs .ant-tabs-ink-bar, 
.cyber-tabs .ant-tabs-ink-bar {
  background: var(--theme-primary-color) !important;
  height: 3px;
}

.result-tabs .ant-tabs-content-holder, 
.cyber-tabs .ant-tabs-content-holder {
  border: 1px solid var(--theme-border-color) !important;
  border-top: none !important; 
  background-color: var(--theme-card-bg) !important;
  border-radius: 0 0 12px 12px;
  padding: 24px;
}

/* Modals & Drawers */
.ant-modal-content {
  background-color: var(--theme-card-bg) !important;
  border: 1px solid var(--theme-border-color);
  color: var(--theme-text-primary);
  border-radius: 16px !important; 
  overflow: hidden;
  box-shadow: var(--theme-box-shadow);
}

.ant-modal-header {
  background-color: var(--theme-modal-header-bg) !important;
  border-bottom: 1px solid var(--theme-border-color) !important;
  color: var(--theme-text-title) !important;
  border-radius: 16px 16px 0 0 !important;
  padding: 20px 24px;
}

.ant-modal-title {
  color: var(--theme-text-title) !important;
  font-weight: 600;
  font-size: 18px;
}

.ant-modal-close-x {
  color: var(--theme-text-secondary);
  font-size: 18px;
}

.ant-modal-body {
  padding: 24px;
}

.ant-drawer-content-wrapper {
  background-color: var(--theme-card-bg) !important; 
  box-shadow: -5px 0 15px rgba(0, 0, 0, 0.1) !important;
  border-radius: 16px 0 0 16px !important;
}

.ant-drawer-header {
  background-color: var(--theme-drawer-header-bg) !important;
  border-bottom: 1px solid var(--theme-border-color) !important;
  border-radius: 16px 0 0 0 !important;
  padding: 20px 24px;
}

.ant-drawer-title {
  color: var(--theme-text-title) !important;
  font-weight: 600;
  font-size: 18px;
}

.ant-drawer-close {
  color: var(--theme-text-secondary);
}

.ant-drawer-body {
  color: var(--theme-text-primary);
  background-color: var(--theme-card-bg); 
  padding: 24px;
}

/* Form Elements */
.ant-input, .ant-input-number, .ant-select-selector, .ant-picker, 
.ant-input-affix-wrapper, .ant-input-number-input-wrap input, 
.ant-input-group-addon, .ant-input-password, .ant-input-textarea textarea,
.ant-input-number-handler-wrap {
  background-color: var(--theme-input-bg) !important;
  border: 1px solid var(--theme-input-border-color) !important;
  color: var(--theme-text-input) !important;
  border-radius: 8px !important;
  padding: 8px 12px;
  transition: all 0.2s ease;
}

.ant-input:focus, .ant-input-focused,
.ant-input-number:focus, .ant-input-number-focused,
.ant-select-focused .ant-select-selector,
.ant-picker-focused,
.ant-input-affix-wrapper-focused,
.ant-input-password:focus, .ant-input-password-focused,
.ant-input-textarea textarea:focus, .ant-input-textarea-focused {
  border-color: var(--theme-primary-color) !important;
  box-shadow: 0 0 0 3px rgba(var(--theme-primary-color-rgb), 0.15) !important;
}

.ant-input::placeholder, .ant-input-number input::placeholder, 
.ant-select-selection-placeholder, .ant-picker-input > input::placeholder, 
.ant-input-textarea textarea::placeholder {
  color: var(--theme-text-tertiary) !important;
  opacity: 0.8;
}

.ant-select-arrow, .ant-picker-suffix, .ant-input-number-handler {
  color: var(--theme-text-tertiary) !important;
}

.ant-select-dropdown { 
  background-color: var(--theme-card-bg) !important;
  box-shadow: var(--theme-box-shadow);
  border: 1px solid var(--theme-border-color);
  border-radius: 8px !important;
  padding: 8px;
}

.ant-select-item {
  color: var(--theme-text-input) !important;
  border-radius: 6px;
  padding: 10px 12px;
  margin: 4px 0;
  transition: all 0.2s ease;
}

.ant-select-item-option-selected:not(.ant-select-item-option-disabled) {
  background-color: var(--theme-menu-selected-bg) !important;
  color: var(--theme-menu-selected-text) !important;
  font-weight: 500;
}

.ant-select-item-option-active:not(.ant-select-item-option-disabled) {
  background-color: var(--theme-menu-hover-bg) !important;
  color: var(--theme-menu-hover-text);
}

.ant-input-search-button {
  background-color: var(--theme-primary-color) !important;
  border-color: var(--theme-primary-color) !important;
  border-radius: 0 8px 8px 0 !important;
}

.ant-input-search-button .anticon {
  color: var(--theme-button-primary-text) !important;
}

/* Buttons */
.ant-btn {
  border-radius: 8px !important;
  font-weight: 500;
  height: auto;
  padding: 8px 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.ant-btn-lg {
  padding: 10px 20px;
  font-size: 15px;
}

.ant-btn-primary {
  background-color: var(--theme-primary-color) !important;
  border-color: var(--theme-primary-color) !important;
  color: var(--theme-button-primary-text) !important; 
  box-shadow: 0 2px 4px rgba(var(--theme-primary-color-rgb), 0.2);
}

.ant-btn-primary:hover, .ant-btn-primary:focus {
  background-color: color-mix(in srgb, var(--theme-primary-color) 90%, black) !important;
  border-color: color-mix(in srgb, var(--theme-primary-color) 90%, black) !important;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(var(--theme-primary-color-rgb), 0.3);
}

.ant-btn-default {
  background-color: var(--theme-card-bg) !important;
  border-color: var(--theme-border-color) !important;
  color: var(--theme-text-primary) !important;
}

.ant-btn-default:hover, .ant-btn-default:focus {
  border-color: var(--theme-primary-color) !important;
  color: var(--theme-primary-color) !important;
  background-color: var(--theme-menu-hover-bg) !important;
}

.ant-btn-text {
  color: var(--theme-text-secondary);
}

.ant-btn-text:hover, .ant-btn-text:focus {
  background-color: var(--theme-menu-hover-bg) !important;
  color: var(--theme-primary-color) !important;
}

/* Chat Interface */
.chat-container {
  display: flex;
  flex-direction: column;
  height: 500px;
  background: var(--theme-card-bg);
  border: 1px solid var(--theme-border-color);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--theme-card-shadow);
}

.chat-header {
  background: var(--theme-card-header-bg);
  padding: 16px 20px;
  border-bottom: 1px solid var(--theme-border-color);
  font-weight: 600;
  color: var(--theme-text-title);
}

.chat-window {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.chat-message {
  max-width: 80%;
  padding: 12px 16px;
  border-radius: 12px;
  position: relative;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.message-user {
  /* background-color: var(--theme-primary-color);
  color: var(--theme-button-primary-text); */
  align-self: flex-end;
  /* border-bottom-right-radius: 4px; */
}

.message-bot {
  /* background-color: var(--theme-input-bg);
  color: var(--theme-text-primary); */
  align-self: flex-start;
  /* border-bottom-left-radius: 4px; */
}

.chat-input-form {
  padding: 16px 20px;
  border-top: 1px solid var(--theme-border-color);
  display: flex;
  gap: 12px;
}

.chat-input {
  flex: 1;
  border-radius: 24px;
  padding: 12px 20px;
}

.send-button {
  border-radius: 50% !important;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
  .app-header {
    padding: 0 16px;
  }
  
  .logo-text {
    display: none;
  }
  
  .app-content {
    padding: 16px;
  }
  
  .content-grid {
    grid-template-columns: 1fr;
  }
  
  .header-actions {
    gap: 8px;
  }
  
  /* .theme-switch-container {
    display: none;
  } */
  
  .app-footer {
    flex-direction: column;
    gap: 8px;
    padding: 12px 16px;
  }
  
  .ant-table-wrapper {
    overflow-x: auto;
  }
}

/* Animations */
@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.03); }
  100% { transform: scale(1); }
}

.alert-pulse {
  animation: pulse 1.5s infinite;
}

/* 新增样式 */
.section-title {
  margin-bottom: 24px;
  position: relative;
  padding-bottom: 12px;
  color: var(--theme-text-title); /* 使用主题标题颜色 */
}

.section-title::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 50px;
  height: 3px;
  background: var(--theme-primary-color);
  border-radius: 3px;
}

.tab-section {
  background: var(--theme-card-bg);
  border-radius: 12px;
  padding: 24px;
  border: 1px solid var(--theme-border-color);
  box-shadow: var(--theme-card-shadow);
  margin-bottom: 24px;
}

.image-preview-container-small {
  border: 1px solid var(--theme-border-color);
  border-radius: 8px;
  overflow: hidden;
  background: var(--theme-input-bg);
}

.safety-alert-main {
  border-radius: 10px;
  border-left-width: 4px;
}

.person-card-content {
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.chart-card .react-google-charts {
  background: var(--theme-card-bg);
  border-radius: 8px;
  padding: 12px;
}

.message-content-bubble {
  /* background: var(--theme-input-bg); */ /* 背景色由JS控制 */
  padding: 12px 16px;
  border-radius: 18px;
  display: inline-block;
  max-width: 90%;
}

.chat-message.user .message-content-bubble {
  /* background: var(--theme-primary-color); */
  /* color: var(--theme-button-primary-text); */
}

.system-logs-container {
  max-height: 300px;
  overflow-y: auto;
  padding: 8px;
  background: var(--theme-input-bg);
  border-radius: 8px;
  border: 1px solid var(--theme-border-color);
}

.log-entry {
  padding: 8px 0;
  border-bottom: 1px solid var(--theme-border-color);
  display: flex;
  align-items: flex-start;
  font-size: 0.9em;
}

.log-entry:last-child {
  border-bottom: none;
}

/* 确保Ant Design的Progress组件的文字颜色适应主题 */
.ant-progress-text {
  color: var(--theme-text-primary) !important;
}

/* Table empty text color */
.ant-empty-description {
  color: var(--theme-text-secondary) !important;
}

/* Descriptions component */
.ant-descriptions-item-label {
  color: var(--theme-text-secondary) !important;
}

.ant-descriptions-item-content {
  color: var(--theme-text-primary) !important;
}

/* Live Stream Modal */
.live-stream-modal .ant-modal-body {
    display: flex;
    padding: 0 !important;
    height: 60vh;
    min-height: 400px;
}

.live-stream-modal .camera-list-sider-modal {
    width: 200px;
    border-right: 1px solid var(--theme-border-color);
    overflow-y: auto;
    background-color: var(--theme-sider-bg); /* Use sider background */
}

.live-stream-modal .camera-menu-modal.ant-menu {
    background: transparent !important;
    border-right: none !important;
    padding-top: 16px;
}

.live-stream-modal .video-content-area-modal {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 16px;
    background-color: var(--theme-content-bg); /* Use content background */
}

.live-stream-modal .video-player-container-modal {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    background: var(--theme-card-bg);
    border-radius: 8px;
    margin-bottom: 16px;
    overflow: hidden; /* Ensure video stays within bounds */
}

.live-stream-modal video {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 8px;
}

.live-stream-modal .device-stream-info-modal {
    background-color: var(--theme-card-bg);
    border: 1px solid var(--theme-border-color);
    border-radius: 8px;
    overflow: hidden;
}

.live-stream-modal .ant-descriptions-item-label {
    background-color: var(--theme-table-header-bg); /* A subtle background for labels */
}

/* Model Train Tab */
.model-train-tab .ant-steps-item-title {
  color: var(--theme-text-primary) !important;
}
.model-train-tab .ant-steps-item-description {
  color: var(--theme-text-secondary) !important;
}
.model-train-tab .ant-steps-item-icon .ant-steps-icon {
  color: var(--theme-primary-color);
}
.model-train-tab .ant-steps-item-wait .ant-steps-icon {
  color: var(--theme-text-tertiary) !important;
}
.model-train-tab .ant-steps-item-finish .ant-steps-icon {
  color: var(--theme-success-color) !important;
}
.model-train-tab .ant-steps-item-error .ant-steps-icon {
  color: var(--theme-error-color) !important;
}

/* Collapse in settings */
.settings-collapse.ant-collapse {
  background-color: var(--theme-card-bg);
  border: 1px solid var(--theme-border-color);
  border-radius: 8px;
}

.settings-collapse .ant-collapse-item {
  border-bottom: 1px solid var(--theme-border-color) !important;
}

.settings-collapse .ant-collapse-item:last-child {
  border-bottom: none !important;
}

.settings-collapse .ant-collapse-header {
  background-color: var(--theme-card-header-bg) !important;
  color: var(--theme-text-primary) !important;
  border-radius: 8px 8px 0 0 !important;
}

.settings-collapse .ant-collapse-header-text {
  font-weight: 500;
}

.settings-collapse .ant-collapse-content-box {
  background-color: var(--theme-card-bg);
  color: var(--theme-text-primary);
  padding: 16px !important;
}

/* Radio.Group for themes */
.ant-radio-button-wrapper {
  background-color: var(--theme-input-bg) !important;
  border-color: var(--theme-input-border-color) !important;
  color: var(--theme-text-primary) !important;
}

.ant-radio-button-wrapper-checked {
  background-color: var(--theme-primary-color) !important;
  border-color: var(--theme-primary-color) !important;
  color: var(--theme-button-primary-text) !important;
}

.ant-radio-button-wrapper:hover {
  color: var(--theme-primary-color) !important;
}

.ant-radio-button-wrapper-checked:hover {
  color: var(--theme-button-primary-text) !important;
}

/* Ant Design List for AI learning materials */
.ant-list {
  background-color: var(--theme-card-bg);
  border: 1px solid var(--theme-border-color);
  border-radius: 8px;
}

.ant-list-item {
  border-bottom: 1px solid var(--theme-border-color) !important;
}

.ant-list-item-meta-title a {
  color: var(--theme-text-primary) !important;
}

.ant-list-item-meta-title a:hover {
  color: var(--theme-primary-color) !important;
}

.ant-list-item-meta-description {
  color: var(--theme-text-secondary) !important;
}

.ant-list-item:last-child {
  border-bottom: none !important;
}

.ant-list-item-action button {
  color: var(--theme-primary-color) !important;
}

.ant-list-item-action button:hover {
  background-color: var(--theme-menu-hover-bg) !important;
}

.ant-badge-count {
  background-color: var(--theme-error-color) !important; /* For notification badge */
}

/* Float Button */
.ant-float-btn {
  background-color: var(--theme-primary-color) !important;
  box-shadow: 0 4px 12px rgba(var(--theme-primary-color-rgb), 0.3) !important;
}

.ant-float-btn:hover {
  background-color: color-mix(in srgb, var(--theme-primary-color) 90%, black) !important;
}

.ant-float-btn-body {
  color: var(--theme-button-primary-text) !important;
}